﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Wyn.PMS.Common.NightAudit
{
    internal class ReadonlyDictionary<K, V> : IDictionary<K, V>
    {
        private readonly IDictionary<K, V> _dict;

        internal IDictionary<K, V> Dict
        {
            get;
            set;
        }

        internal ReadonlyDictionary(IDictionary<K, V> dict)
        {
            _dict = dict;
        }

        public IEnumerator<KeyValuePair<K, V>> GetEnumerator()
        {
            return _dict.GetEnumerator();
        }

        IEnumerator IEnumerable.GetEnumerator()
        {
            return ((IEnumerable)_dict).GetEnumerator();
        }

        public void Add(KeyValuePair<K, V> item)
        {
            throw new System.NotImplementedException();
        }

        public void Clear()
        {
            throw new System.NotImplementedException();
        }

        public bool Contains(KeyValuePair<K, V> item)
        {
            return _dict.Contains(item);
        }

        public void CopyTo(KeyValuePair<K, V>[] array, int arrayIndex)
        {
            throw new System.NotImplementedException();
        }

        public bool Remove(KeyValuePair<K, V> item)
        {
            throw new System.NotImplementedException();
        }

        public int Count
        {
            get { return _dict.Count; }
        }

        public bool IsReadOnly
        {
            get { return true; }
        }

        public bool ContainsKey(K key)
        {
            return _dict.ContainsKey(key);
        }

        public void Add(K key, V value)
        {
            throw new System.NotImplementedException();
        }

        public bool Remove(K key)
        {
            throw new System.NotImplementedException();
        }

        public bool TryGetValue(K key, out V value)
        {
            return _dict.TryGetValue(key, out value);
        }

        public V this[K key]
        {
            get { return _dict.ContainsKey(key) ? _dict[key] : default(V); }
            set { throw new System.NotImplementedException(); }
        }

        public ICollection<K> Keys
        {
            get 
            {
                return _dict.Keys;
            }
        }

        public ICollection<V> Values
        {
            get { return _dict.Values; }
        }
    }
}

